﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.ModelConfiguration;
using System.Data.Entity.ModelConfiguration.Configuration;
using Elf.Data.Entity.Interfaces;

namespace Elf.Data.Entity.Configuration
{
    /// <summary>
    /// Base for all entity configuration claaes.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public abstract class EntityConfigurationBase<T> :
        EntityTypeConfiguration<T>,
        IEntityConfiguration
        where T : class, IEntityBase
    {
        /// <summary>
        /// Adds the configuration.
        /// </summary>
        /// <param name="registrar">The registrar.</param>
        public void AddConfiguration(ConfigurationRegistrar registrar)
        {
            if (registrar == null) throw new ArgumentNullException("registrar");

            registrar.Add(this);
        }
    }
}
